package com.yuanmei.charts;

import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.LineDataSet;

public class TaLib {

     public static float emaSummary(float oldEma, float value, int period) {
        float divisor = period + 1;
        float newEma = (oldEma * (period - 1)) / divisor + value * 2 / divisor;
        return newEma;
    }

    public static void setCommonMaStyle(LineDataSet maSet) {
        maSet.setHighlightEnabled(false);
        maSet.setDrawValues(false);
        maSet.setLineWidth(1f);
        maSet.setDrawCircles(false);
        maSet.setAxisDependency(YAxis.AxisDependency.LEFT);
    }

    public static void setCommonCDPStyle(LineDataSet set) {
        set.setHighlightEnabled(false);
        set.setDrawValues(false);
        set.setLineWidth(2f);
        set.setDrawCircles(false);
        set.setAxisDependency(YAxis.AxisDependency.LEFT);
    }
}
